<!-- Nested node template -->
<script type="text/ng-template" id="nodes_renderer.html">
  <div ui-tree-handle class="tree-node tree-node-content"
    ng-click="getit(this)"
  >
    <a class="btn btn-success btn-xs" ng-if="node.nodes && node.nodes.length > 0" 
    data-nodrag ng-click="toggle(this)">
    <span class="glyphicon"
        ng-class="{
          'glyphicon-chevron-right': collapsed,
          'glyphicon-chevron-down': !collapsed
        }"></span></a>
    {{node.name}} （{{node.code}}）
    <!-- <a class="pull-right btn btn-danger btn-xs" data-nodrag ng-click="remove(this)"><span
        class="glyphicon glyphicon-remove"></span></a> -->
    <!-- <a class="pull-right btn btn-primary btn-xs" data-nodrag 
    ng-click="newSubItem(this,$event)" style="margin-right: 8px;">
      <span class="glyphicon glyphicon-plus"></span>
    </a> -->
  </div>
  <ol ui-tree-nodes="" ng-model="node.nodes" ng-class="{hidden: collapsed}">
    <li ng-repeat="node in node.nodes" ui-tree-node ng-include="'nodes_renderer.html'">
    </li>
  </ol>
</script>

<div class="row">
  <div class="col-sm-4">
    <div class="col-sm-12">
      <button type="button" class="btn btn-default" ng-click="createstb()">
        创建分销
      </button>
      <!-- <button type="button" class="btn btn-default" ng-click="create()">
        创建新用户
      </button> -->
    </div>
    <div class="col-sm-12">
      <div ui-tree id="tree-root" data-nodrop-enabled="true" data-drag-enabled="false">
        <ol ui-tree-nodes ng-model="data">
          <li ng-repeat="node in data" ui-tree-node ng-include="'nodes_renderer.html'"></li>
        </ol>
      </div>
    </div>

  </div>

  <div class="col-sm-8" ng-show="officeid != ''">
    
    <!-- <pre class="code">{{ data | json }}</pre> -->

    <!-- <pre class="code">{{ show | json }}</pre> -->

      <table class="table table-bordered">
      <thead>
        <tr>
          <th class="col-md-3 text-center">登录名</th>
          <th class="col-md-3 text-center">姓名</th>
          <th class="col-md-3 text-center">电话</th>
          <th class="col-md-3 text-center">操作</th>
        </tr>
      </thead>
      <tbody>
        <tr ng-repeat="obj in objs">
          <td class="text-center">{{obj.loginName}}</td>
          <td class="text-center">{{obj.name}}</td>
          <td class="text-center">{{obj.mobile}}</td>
          <td class="text-center">
            <a ng-click="edit(obj.id)" class="btn btn-success btn-xs"
              ng-show="editshow == true"
            >编辑</a>
          </td>
        </tr>
        <!-- <tr ng-show="objs == undefined">
          <td class="text-center"></td>
          <td class="text-center"></td>
          <td class="text-center"></td>
          <td class="text-center">
            <a ng-click="default()" class="btn btn-danger btn-xs"
            >创建默认帐号</a>
          </td>
        </tr> -->

      </tbody>
    </table>

  <div class="text-right">

      <uib-pagination 
        total-items="bigTotalItems" 
        ng-model="bigCurrentPage" 
        max-size="maxSize" 
        class="pagination-sm" 
        boundary-links="true" 
        ng-change="load()"
        items-per-page="itemsPerPage"
        previous-text="上一页"
        next-text="下一页"
        first-text="首页"
        last-text="末页"
        rotate="false">
      </uib-pagination>

  </div>


  </div>
</div>
